UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CQ56cMTd3y1cAhsi7b873eIme61b7fYqWTOOZSUQv+c='
WHERE
key_id = '55bfff4d2d6958b837e293a7b7e41712e9d4c360830cba77e6f9af38d8fef10e'
AND (
token = 'CQ56cMTd3y1cAhsi7b873eIme61b7fYqWTOOZSUQv+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)