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