UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PvAbqUtfqUjXymGG0HZdqnFPe7O/sMwOip/tsP0/U5I=' 
WHERE 
  key_id = '0ace900e775ba2672e30d5108fee2a228c96b054c3688e887ff8a1d18e8370cb' 
  AND (
    token = 'PvAbqUtfqUjXymGG0HZdqnFPe7O/sMwOip/tsP0/U5I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033