UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Sx57ug5uc+21ZPUVZbzMLQxxKyASfcf02L2FMXVDI9E='
WHERE
key_id = 'b527298db333a6cf1ccf1ebe7bd719c8e50e82e094a04debd993ff1b99f6bfb9'
AND (
token = 'Sx57ug5uc+21ZPUVZbzMLQxxKyASfcf02L2FMXVDI9E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)