UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fZwQk0Rmw5gz7iaVM+mW7rKNe2szw7EtkGTo5w66SZo='
WHERE
key_id = '9ac5758499a99ef0b7fbefb34f51ebee880491eefdfdc5b3c04caa456de4858a'
AND (
token = 'fZwQk0Rmw5gz7iaVM+mW7rKNe2szw7EtkGTo5w66SZo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)