UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't4J9xckrvcKuwj50aZde4NDAUg9zDWBsHRm6cKV/mXs=' 
WHERE 
  key_id = '217ca6f6b2e5e9f0efe99c6631f19cf64f37a75cf68b867b9aefd5b36f98882c' 
  AND (
    token = 't4J9xckrvcKuwj50aZde4NDAUg9zDWBsHRm6cKV/mXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036