UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SnAtsXBuCa4bHvWMLQ9pcxYd9njd9FrYTlp/I2PuaMY='
WHERE
key_id = '01d82d5b31a67a09a759ad62c884b6e5120a431b570f19cbfc47561629e253c8'
AND (
token = 'SnAtsXBuCa4bHvWMLQ9pcxYd9njd9FrYTlp/I2PuaMY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)