UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TxaxndM3VcJmMJMbhYCRDnm72IfwaJ5gVJznAwFSIDI=' 
WHERE 
  key_id = '8b19d50b35f85592634d14435d1452e1ced356fb608b57029efd87f2334c54bd' 
  AND (
    token = 'TxaxndM3VcJmMJMbhYCRDnm72IfwaJ5gVJznAwFSIDI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029