UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3Q6qJ9twDceiFgGngM3gINU8ssg3nU7vcToSVwFe65w='
WHERE
key_id = '5f2b7983f1ffda2b4ed99d0e8e611a1710c6d99bfdbc3940132685896371c03e'
AND (
token = '3Q6qJ9twDceiFgGngM3gINU8ssg3nU7vcToSVwFe65w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)