UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2LLnw2OCfyKEhNunWd8i5tLK50zw+BopxOaBEAT+IkM=' 
WHERE 
  key_id = '9d3df8456207cb94ed04ed3562bd2c4018c3965bd09087d7f950d88c93277a35' 
  AND (
    token = '2LLnw2OCfyKEhNunWd8i5tLK50zw+BopxOaBEAT+IkM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028