UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MMPnWb/l1GfQ7fiy0IpIU9gguUveeXwFPdYD/vlg64I='
WHERE
key_id = 'd04a740beb1803a9244e81289a1d586963b045b54a605f9820f822e18be07af8'
AND (
token = 'MMPnWb/l1GfQ7fiy0IpIU9gguUveeXwFPdYD/vlg64I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)