UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AvP5cSjo9IJPtA27Mf/lgQKN/1sqTlcOw3A6jjY8w1U='
WHERE
key_id = 'c7404d5c12eab2d3724bcdb3eded2c53f17f2d67835f6e83d897fa4625f5ebf5'
AND (
token = 'AvP5cSjo9IJPtA27Mf/lgQKN/1sqTlcOw3A6jjY8w1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)