UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I9OYA0Ss1a2cibWmLZVFCuju18EgJrG2UVorbEkgUV4=' 
WHERE 
  key_id = '1a36c266bdb2fd437488262ac59a4fd4589486ea0ed118fbfe5c5fd1d15a8739' 
  AND (
    token = 'I9OYA0Ss1a2cibWmLZVFCuju18EgJrG2UVorbEkgUV4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048