UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S6cyd+enGXmwLGSfB8HNqlTF5QWT6UlKqiQyIt8K+4g='
WHERE
key_id = 'd9c32e137a247ec8bc26d8d2c2261e4129acbaca0223f6c9e5bd271835eb8e49'
AND (
token = 'S6cyd+enGXmwLGSfB8HNqlTF5QWT6UlKqiQyIt8K+4g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)