UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b2/0UKTIZMkep7iaZvVHUPW7whtza6tlD16H7Qb+U1I='
WHERE
key_id = 'cd7b04bc8589d15acd468eaeac552a286134b53975020f06765a57c569021d6a'
AND (
token = 'b2/0UKTIZMkep7iaZvVHUPW7whtza6tlD16H7Qb+U1I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)