UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4y/wQ8mq8NjE6UT86CJ3hxbLqKbEwimvtoEwCfFP+00='
WHERE
key_id = '3895001b43305304b7b7429ad5260939fb1a18e3501655e18624c986335434c3'
AND (
token = '4y/wQ8mq8NjE6UT86CJ3hxbLqKbEwimvtoEwCfFP+00='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)