UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z2UM6l7j4aFiI9g8H61rlGmdVIkff9qUfNlQQpjEiDA='
WHERE
key_id = 'b68f06fb8ba86bbbe66ae7c05304f20ace2167a7ad905911849ecb8567d90b5a'
AND (
token = 'Z2UM6l7j4aFiI9g8H61rlGmdVIkff9qUfNlQQpjEiDA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)