UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wc4Alh3eiG35VqL2cZRjr7c7T5Z9uASZ3G9OIf8OVrE=' 
WHERE 
  key_id = 'c87fd07012576ebdd03d76b52ffcbfe96ac361045722c56072f631266a1223e8' 
  AND (
    token = 'Wc4Alh3eiG35VqL2cZRjr7c7T5Z9uASZ3G9OIf8OVrE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039