UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3NpbyxsD9clMwiyWI6L+MyYjlCU6xT+CDxypFfVqndg='
WHERE
key_id = 'ba8f120b3b3162b8d993356be6ac3da0a2c9d6d1c4a896a83d0d56671b519b64'
AND (
token = '3NpbyxsD9clMwiyWI6L+MyYjlCU6xT+CDxypFfVqndg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)