UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+rDjwffehnw1iBv/ZCx4SGpCL8afCDEt2YkqujbE7Fc='
WHERE
key_id = 'fbffe99e4fb235e5de7618187dd7e01807ce828a2fee824d33772a2557c91fe3'
AND (
token = '+rDjwffehnw1iBv/ZCx4SGpCL8afCDEt2YkqujbE7Fc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)