UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U63YzEzlSfkewmwyNsegNDALcRQsPJKuicdWfa3NIik=' 
WHERE 
  key_id = '3b07a165a86f156d4f4d4f71822588d9894b2634fd6db5800393b3a3fb1d57ca' 
  AND (
    token = 'U63YzEzlSfkewmwyNsegNDALcRQsPJKuicdWfa3NIik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017