UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MNtTj9cmXSNPOjcqJP734LrmBeH0bRfs/lKOeC7hly4='
WHERE
key_id = 'd4c72782aa121eb73812051e0afd63441fb1cb45b740cc09c188b90c95fc3ee2'
AND (
token = 'MNtTj9cmXSNPOjcqJP734LrmBeH0bRfs/lKOeC7hly4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)