UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ba7HDTOWoYM9HBopvBpcJpu44lD6/QlUSSEVqWKPbs0=' 
WHERE 
  key_id = '5a05e68679366d1dced4c0dc31ae3c78d183bc931481735cca784288fc7168fc' 
  AND (
    token = 'Ba7HDTOWoYM9HBopvBpcJpu44lD6/QlUSSEVqWKPbs0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046