UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n7IY1MxPcQxDQIVnKUoNuCcCY5yL2sPvnJ8cUYJnD4w=' 
WHERE 
  key_id = '574b5890890dfae4cf4f1e8884b67b43a47856d40d848f0bb21d5c2d1b074597' 
  AND (
    token = 'n7IY1MxPcQxDQIVnKUoNuCcCY5yL2sPvnJ8cUYJnD4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039