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