UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SHC9AlQd/nIra6GUKFfEYQ489iXbVKKWMcsMaFV3HgM='
WHERE
key_id = '748c6b0da3362e5d74c1aae438a64220d7cc9b331f11beb08d68b7c379fca999'
AND (
token = 'SHC9AlQd/nIra6GUKFfEYQ489iXbVKKWMcsMaFV3HgM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)