UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mewdwNAyyj0avr/SdtTWXx+WtIhZFcre64+pl3CeOb4='
WHERE
key_id = '9759476b81ae6daa34434218495f207b52d7032a6c925a6334869cc93ee9bdb8'
AND (
token = 'mewdwNAyyj0avr/SdtTWXx+WtIhZFcre64+pl3CeOb4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)