UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ptsMte/2ONW2eq1/Huj1vq43WTlarN3xHCpzgM8oRR0='
WHERE
key_id = 'b9401bc4f6f31185f7975490ab77a81b1ff9634aff371504f658483bca8a5fda'
AND (
token = 'ptsMte/2ONW2eq1/Huj1vq43WTlarN3xHCpzgM8oRR0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)