UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N0mJjAY0R4exEdJptDA6jcFTSKtec/WYcCZLuIijM58='
WHERE
key_id = '9de3beb1951ce0e88bab0b2f02f4bfd23d9a6bf1cfd676880b7d428ef36996fa'
AND (
token = 'N0mJjAY0R4exEdJptDA6jcFTSKtec/WYcCZLuIijM58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)