UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ibvNJwkbhwPS51jpVfcGe5PkNsjVU+53vkUX9h+ZOYo=' 
WHERE 
  key_id = 'bd5d64d886c2ef8ebf56a1a832b8d5d2b07b2c84d584013781aa1278c765eaac' 
  AND (
    token = 'ibvNJwkbhwPS51jpVfcGe5PkNsjVU+53vkUX9h+ZOYo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026