UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ThzNbYbJLeUfMDc5qd/iXJItV9XIvYZrKsBo6SO9+Dw='
WHERE
key_id = 'd37cf815f1bef15a402f958b6762645c83b8e5385a27eb0ab7ca40e0c4267fee'
AND (
token = 'ThzNbYbJLeUfMDc5qd/iXJItV9XIvYZrKsBo6SO9+Dw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)