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