UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JbWPH8y6jRfiwfRSthRjnDv49slzZvgrU6P7xIX7w28='
WHERE
key_id = '6beec00a2af9b596c7c4e16b4383db66d4b499b55fb576910b055a95f00d2370'
AND (
token = 'JbWPH8y6jRfiwfRSthRjnDv49slzZvgrU6P7xIX7w28='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)