UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rMMFqRIDTGiKx0Nuhfs6ZTq5BjUvByt+cURoPpJvPhE=' 
WHERE 
  key_id = 'c4140afb97ac5203faf32594776a142859aa0f9839cc00c213a6d28782076a54' 
  AND (
    token = 'rMMFqRIDTGiKx0Nuhfs6ZTq5BjUvByt+cURoPpJvPhE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055