UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LOKD80orx0UwAmRoCoEb60KhVcAtRthLveFjcXCKhRs=' 
WHERE 
  key_id = 'e018ac1e243b816007abccbd0459eeb0411c066e9a1f682f5d983709df338b29' 
  AND (
    token = 'LOKD80orx0UwAmRoCoEb60KhVcAtRthLveFjcXCKhRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025