UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DUupsB1SB7l+LbT+Wp47tK8EsdIZpu6F7/bBDULq5C4='
WHERE
key_id = 'ece9962a9cdb554df5f851848fd4c6d55154f4a06ad7a990b7fe4c2502a6605e'
AND (
token = 'DUupsB1SB7l+LbT+Wp47tK8EsdIZpu6F7/bBDULq5C4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)