UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IM5kjCWVIoE2mEqp0c4Y7grv7eBDFSXbqVR0PIV8s8o=' 
WHERE 
  key_id = '7c831f4f7bd8c8843376398ea8110953972f62bb0e97223cc45754cfdc2e629c' 
  AND (
    token = 'IM5kjCWVIoE2mEqp0c4Y7grv7eBDFSXbqVR0PIV8s8o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046