UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd5lCydAVsqzwVmCS32B7jLcPk0a6gdZtR7o4A72Wj5s='
WHERE
key_id = '8e2f4f12e2c2d4b31ad53b883f4c8f98235120c781d7c98954f41c3d364fb8b7'
AND (
token = 'd5lCydAVsqzwVmCS32B7jLcPk0a6gdZtR7o4A72Wj5s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)