UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cFmyKS87+FiyWrN02POQEECMqbizpp3cIE31zwBvUhs=' 
WHERE 
  key_id = '6887dffaef7a859822ed28898755a8fefc1871026a02799e4d313d0269c9e5ba' 
  AND (
    token = 'cFmyKS87+FiyWrN02POQEECMqbizpp3cIE31zwBvUhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017