UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8Tekn6lvoIxIF3Aq7BIdCoqbL4ov6S211cxN0dXYyB4='
WHERE
key_id = 'd7b75a5309dc2c23eed571f7929030469b6b33abefbe45155bb084c2326e5ae8'
AND (
token = '8Tekn6lvoIxIF3Aq7BIdCoqbL4ov6S211cxN0dXYyB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)