UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w/QjRKIy077QgWD4XvI611c1jJe3yYqWLNFggb6dQe0='
WHERE
key_id = '99d87811e2723615f2a13e73ac8dd8e2b91d663c12aa4fcb32b0aadea478bef6'
AND (
token = 'w/QjRKIy077QgWD4XvI611c1jJe3yYqWLNFggb6dQe0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)