UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y9prQri9aglY/GgEUPuzuVWUinabQMyZ2UA3QUZHLws=' 
WHERE 
  key_id = '4910fcc2efb43963fe5039b42aaffceb22b94552b0ea831f855fc71251b72f6c' 
  AND (
    token = 'Y9prQri9aglY/GgEUPuzuVWUinabQMyZ2UA3QUZHLws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046